#+TITLE:    Mora Unie Youer's Doom Emacs configuration
#+AUTHOR:   Mora Unie Youer
#+EMAIL:    mora_unie_youer@riseup.net
#+LANGUAGE: en
#+PROPERTY: header-args :tangle yes :results silent :cache yes :padline no

* Doom
This section is used to fully configure =init.el=.
** doom!ing
:PROPERTIES:
:header-args:emacs-lisp: :tangle no
:END:

#+name: init.el
#+begin_src emacs-lisp :tangle "init.el" :noweb yes
;;; init.el -*- lexical-binding: t; -*-

;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE This file is autogenerated from config.org

;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;;      documentation. There you'll find a link to Doom's Module Index where all
;;      of our modules are listed, including what flags they support.

;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;;      'C-c c k' for non-vim users) to view its documentation. This works on
;;      flags as well (those symbols that start with a plus).
;;
;;      Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;;      directory (for easy access to its source code).

(doom! :input
       <<doom-input>>
       :completion
       <<doom-completion>>
       :ui
       <<doom-ui>>
       :editor
       <<doom-editor>>
       :emacs
       <<doom-emacs>>
       :term
       <<doom-term>>
       :checkers
       <<doom-checkers>>
       :tools
       <<doom-tools>>
       :os
       <<doom-os>>
       :lang
       <<doom-lang>>
       :email
       <<doom-email>>
       :app
       <<doom-app>>
       :config
       <<doom-config>>
)
#+end_src

#+name: packages.el
#+begin_src emacs-lisp :tangle "packages.el"
;;; packages.el -*- no-byte-compile: t; -*-
;; NOTE This file is autogenerated from config.org

;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.


;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;(package! some-package)

;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;(package! another-package
;  :recipe (:host github :repo "username/repo"))

;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;(package! this-package
;  :recipe (:host github :repo "username/repo"
;           :files ("some-file.el" "src/lisp/*.el")))

;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;(package! builtin-package :disable t)

;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;(package! builtin-package :recipe (:nonrecursive t))
;(package! builtin-package-2 :recipe (:repo "myfork/package"))

;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;(package! builtin-package :recipe (:branch "develop"))

;; Use `:pin' to specify a particular commit to install.
;(package! builtin-package :pin "1a2b3c4d5e")


;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;(unpin! pinned-package)
;; ...or multiple packages
;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;(unpin! t)

#+end_src

*** Modules
**** Input
#+name: doom-input
#+begin_src emacs-lisp
; input modules
;;chinese               ; chinese input integration
;;japanese              ; japanese input integration
;;layout
#+end_src
**** Completion
#+name: doom-completion
#+begin_src emacs-lisp
; completion modules
(company                ; the ultimate code completion backend
 +childframe)           ; enable displaying completion candidates in child frame
;;helm                  ; the *other* search engine for love and life
;;ido                   ; the other *other* search engine...
;;(ivy                  ; a search engine for love and life
;; +childframe          ; displaying ivy in floating child frame
;; +fuzzy               ; enable fuzzy search
;; +icons               ; enable icons
;; +prescient)          ; enable prescient filtering and searching
(vertico                ; the search engine of the future
 +icons)                ; add icons to `file` and `buffer`
#+end_src
**** UI
#+name: doom-ui
#+begin_src emacs-lisp
; UI modules
deft                    ; notational velocity for Emacs
doom                    ; what makes DOOM look the way it does
doom-dashboard          ; a nifty splash screen for Emacs
doom-quit               ; DOOM quit-message prompts when you quit Emacs
(emoji                  ; emoji support
 +ascii                 ; :)
 +github                ; :smile:
 +unicode)              ; 🙂
hl-todo                 ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
hydra                   ;
;;indent-guides         ; highlight indentation
(ligatures              ; enable ligatures and symbols
 +extra                 ; enable extra ligatures like lambda
 +fira)                 ; FiraCode ligatures
minimap                 ; show a map of the code on the side
modeline                ; snazzy, Atom-inspired modeline
;; +light)              ; light version of modeline
nav-flash               ; blink cursor line after big motions
;;neotree               ; a project drawer, like NERDTree
ophints                 ; highlight the region an operation acts on
(popup +all)            ; tame sudden yet inevitable temporary windows
;;tabs                  ; a tab bar for Emacs
(treemacs               ; a project drawer, like neotree but cooler
 +lsp)                  ; enable lsp integration
unicode                 ; extended unicode support for various languages
vc-gutter               ; vsc diff in the fringe
vi-tilde-fringe         ; fringe tildes to mark beyond EOB
(window-select          ; visually switch windows
 +numbers)              ; enable numbered windows
workspaces              ; tab emulation, persistence & separate workspaces
zen                     ; distraction-free coding or writing
#+end_src
**** Editor
#+name: doom-editor
#+begin_src emacs-lisp
; editor modules
(evil                   ; come to the dark side, we have cookies
 +everywhere)           ; enable it everywhere it possible
file-templates          ; auto-snippets for empty files
fold                    ; (nigh) universal code folding
(format                 ; automated prettiness
 +onsave)               ; prettify on save
;;god                   ; run Emacs commands without modifier keys
;;lispy                 ; vim for lisp, for people who don't like vim
multiple-cursors        ; editing in many places at once
;;objed                 ; text object editing for the innocent
;;parinfer              ; turn lisp into python, sort of
rotate-text             ; cycle region at point between text candidates
snippets                ; my elves. They tipe so I don't have to
word-wrap               ; soft wrapping with language-aware indent
#+end_src
**** Emacs
#+name: doom-emacs
#+begin_src emacs-lisp
; emacs modules
(dired                  ; making dired pretty
 +icons                 ; enabling icons in dired
 +ranger)               ; making dired to be more like ranger
electric                ; smarted, keyword-based electric-indent
(ibuffer                ; interactive buffer management
 +icons)                ; enabling icons in ibuffer
(undo                   ; persistent, smarter undo for your inevitable mistakes
 +tree)                 ; using undo-tree instead of undo-fu
vc                      ; version-control and Emacs, sitting in a tree
#+end_src
**** Terminal
#+name: doom-term
#+begin_src emacs-lisp
; terminal modules
eshell                  ; the elisp shell that works everywhere
;;shell                 ; simple shell REPL for Emacs
;;term                  ; basic terminal emulator for Emacs
vterm                   ; the best terminal emulation in Emacs
#+end_src
**** Checkers
#+name: doom-checkers
#+begin_src emacs-lisp
; checkers modules
(syntax                 ; tasing you for every semicolon you forget
 +childframe)           ; displaying in a child frame
(spell                  ; tasing you for misspelling misspelling
 +aspell                ; using aspell as backend
 +everywhere            ; tasing you everywhere
 +flyspell)             ; using `flyspell` instead of `spell-fu`
grammar
#+end_src
**** Tools
#+name: doom-tools
#+begin_src emacs-lisp
; tools modules
ansible                 ;
biblio                  ; writes a PhD for you (citation needed)
debugger                ; FIXME stepping through code, to help you add bugs
direnv                  ;
(docker                 ; manipulate your Docker
 +lsp)                  ; enable lsp integration
editorconfig            ; let someone else argue about tabs vs spaces
ein                     ; tame Jupyter notebooks with Emacs
(eval +overlay)         ; run code, run (also, repls)
gist                    ; interacting with github gists
(lookup                 ; navigate your code and its documentation
 +dictionary            ; enable word definition and thesaurus lookup
 +offline               ; install and prefer offline dictionaries
 +docsets)              ; enable integration with Dash.app docsets
(lsp                    ; M-x vscode
 +peek)                 ; use `lsp-ui-peek`
(magit                  ; a git porcelain for Emacs
 +forge)                ; enable Forge
make                    ; run make tasks from Emacs
(pass                   ; password manager for nerds
 +auth)                 ; enable `auth-source-pass'
pdf                     ; pdf enhancements
prodigy                 ; FIXME managing external services & code builders
rgb                     ; creating color strings
taskrunner              ; taskrunner for all your projects
terraform               ; infrastructure as code
tmux                    ; an API for interacting with tmux
upload                  ; map local to remote projects via ssh/ftp
#+end_src
**** OS
#+name: doom-os
#+begin_src emacs-lisp
; os modules
(:if IS-MAC macos)      ; improve compatibility with macOS
tty                     ; improve the terminal Emacs experience
#+end_src
**** Languages
#+name: doom-lang
#+begin_src emacs-lisp
; lang modules
;;agda                  ; types of types of types of types
;;beancount             ; mind the GAAP
(cc                     ; C > C++ == 1
 +lsp)                  ; enable lsp integration
(clojure                ; java with a lisp
 +lsp)                  ; enable lsp integration
common-lisp             ; if you've seen one lisp, you've seen them all
coq                     ; proofs-as-programs
;;crystal               ; ruby at the speed of c
;;csharp                ; unity, .NEW, and mono shenanigans
;;data                  ; config/data formats
;;(dart +flutter)       ; paint ui and not much else
;;dhall                 ;
;;elixir                ; erlang done right
;;elm                   ; care for a cup of TEA?
emacs-lisp              ; drown in parentheses
(erlang                 ; an elegant language for a more civilized age
 +lsp)                  ; enable lsp integration
(ess                    ; emacs speaks statistics
 +lsp)                  ; enable lsp integration
;;factor                ;
;;faust                 ; dsp, but you get to keep your soul
;;fortran               ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp                ; ML stands for Microsoft's Language
;;fstar                 ; (dependent) types and (monadic) effects and Z3
;;gdscript              ; the language you waited for
(go                     ; the hipster dialect
 +lsp)                  ; enable lsp integration
(haskell                ; a language that's lazier than I am
 +lsp)                  ; enable lsp integration
;;hy                    ; readability of scheme w/ speed of python
;;idris                 ; a language you can depend on
(java                   ; the poster child for carpal tunnel syndrome
 +lsp                   ; enable lsp integration
 +meghanada)            ; enable meghanada-mode
(javascript             ; all(hope(abandon(ye(who(enter(here))))))
 +lsp)                  ; enable lsp integration
(json                   ; at least it ain't XML
 +lsp)                  ; enable lsp integration
(julia                  ; a better, faster MATLAB
 +lsp)                  ; enable lsp integration
(kotlin                 ; a better, slicker Java(Script)
 +lsp)                  ; enable lsp integration
(latex                  ; writing papers in Emacs has never been so fun
 +cdlatex               ; enable cdlatex
 +lsp)                  ; enable lsp integration
lean                    ; for folks with too much to prove
ledger                  ; be audit you can be
(lua                    ; one-based indices? one-based indices
 +fennel                ; enable Fennel language support
 +lsp                   ; enable lsp integration
 +moonscript)           ; enable Moonscript language support
(markdown               ; writing docs for people to ignore
 +grip)                 ; enable grip support
nim                     ; python + lisp at the speed of C
nix                     ; I hereby declare "nix geht mehr!"
(ocaml                  ; an objective camel
 +lsp)                  ; enable lsp integration
(org                    ; organize your plain life in plain text
 +brain                 ; org-brain
 ;;+journal             ; org-journal
 +noter                 ; org-noter
 +pomodoro              ; org-pomodoro
 +present               ; org-presentations
 +pretty                ; better displaying of org-mode
 +roam2)                ; knowledge system
(php                    ; perl's insecure younger brother
 +hack                  ; enable Hack dialect support
 +lsp)                  ; enable lsp integration
;;plantuml              ; diagrams for confusing people more
(purescript             ; javascript, but functional
 +lsp)                  ; enable lsp integration
(python                 ; beautiful is better than ugly
 +cython                ; enable Cython files support
 +lsp                   ; enable lsp integration
 +pyenv)                ; enable `pyenv` support
qt                      ; the 'cutest' gui framework ever
(racket                 ; a DSL for DSLs
 +lsp                   ; enable lsp integration
 +xp)                   ; something useful, I guess :P
raku                    ; the artist formerly known as perl6
rest                    ; Emacs as a REST client
;;rst                   ; ReST in peace
(ruby                   ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
 +lsp                   ; enable lsp integration
 +rails                 ; enable Ruby on Rails support
 +rvm)                  ; enable `rvm` support
(rust                   ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
 +lsp)                  ; enable lsp integration
(scala                  ; java, but good
 +lsp)                  ; enable lsp integration
(scheme                 ; a fully conniving family of lisps
 +chez                  ;
 +chibi                 ;
 +chicken               ;
 +gambit                ;
 +gauche                ;
 +guile                 ;
 +kawa                  ;
 +mit                   ;
 +racket)               ;
(sh                     ; she sells {ba,z,fi}sh shells on the C xor
 +fish                  ; enable fish support
 +lsp)                  ; enable lsp integration
;;sml                   ;
solidity                ; do you need a blockchain? No.
(swift                  ; who asked for emoji variables?
 +lsp)                  ; enable lsp integration
terra                   ; Earth and Moon in alignment for performance
(web                    ; the tubes
 +lsp)                  ; enable lsp integration
(yaml                   ; JSON, but readable
 +lsp)                  ; enable lsp integration
(zig                    ; C, but simpler
 +lsp)                  ; enable lsp integration
#+end_src
**** E-Mail
#+name: doom-email
#+begin_src emacs-lisp
; email modules
;;(mu4e +gmail +org)    ; mu4e email client
(notmuch                ; notmuch email client
 +afew                  ; enable integration with `afew`
 +org)                  ; enable org-mime for writing HTML emails
;;(wanderlust +gmail)   ;
#+end_src
**** Applications
#+name: doom-app
#+begin_src emacs-lisp
; applications modules
calendar                ;
emms                    ; do you like music?
everywhere              ; *leave* Emacs!? You must be joking
irc                     ; how neckbeards socialize
(rss                    ; Emacs as an RSS reader
 +org)                  ; enable org integration
;;twitter               ; twitter client
#+end_src
**** Configuration
#+name: doom-config
#+begin_src emacs-lisp
; configuration modules
(default        ; configuration defaults
 +bindings      ; configuration default bindings
 +smartparens)  ; enable smartparens
literate        ; enable support for configuration in .org file
#+end_src
* Configuration
** This is me :3
Some functionality uses this to identify me, e.g. GPG configuration, email
clients, file templates and snippets. It is optional.
#+begin_src emacs-lisp
(setq user-full-name    "Mora Unie Youer"
      user-mail-address "mora_unie_youer@riseup.net")
#+end_src

** UI
*** Dashboard
Setting splash image.
#+begin_src emacs-lisp
(setq fancy-splash-image (concat doom-private-dir "avatar.png"))
(setq +doom-dashboard-banner-padding '(0 . 2))
#+end_src

Showing only banner and loaded message.
#+begin_src emacs-lisp
(setq +doom-dashboard-functions '(doom-dashboard-widget-banner
                                  doom-dashboard-widget-loaded))
#+end_src

Adding message to loaded message.
#+begin_src emacs-lisp
(defadvice! doom-dashboard-widget-loaded-with-message ()
  "Print some message in dashboard."
  :override #'doom-dashboard-widget-loaded
  (insert
   (propertize
    (+doom-dashboard--center
     +doom-dashboard--width
     "Welcome to the club, buddy!")
    'face 'doom-dashboard-menu-title)
   "\n"
   (propertize
    (+doom-dashboard--center
     +doom-dashboard--width
     (doom-display-benchmark-h 'return))
    'face 'doom-dashboard-loaded)
   "\n"))
#+end_src

*** Fonts
Really like FiraCode font, so I will use it. <3
#+begin_src emacs-lisp
(setq doom-font (font-spec :family "FiraCode Nerd Font Mono" :size 11 :weight 'semi-light))
#+end_src

*** Line numbers
This determines the style of line numbers in effect. If set to =nil=, line
numbers are disabled. For relative line numbers, set this to =relative=.
#+begin_src emacs-lisp
(setq display-line-numbers-type 'relative)
#+end_src

*** Theme
This is theme I really like. :3
#+begin_src emacs-lisp
(setq doom-theme 'doom-1337)
#+end_src

** org-mode
Let's be honest. This thing is really impressive. So, I need to configure it for
my purposes. I hope that org-mode will change my life.
*** Literate config
Disable tangle on save.
#+begin_src emacs-lisp
(remove-hook 'org-mode-hook #'+literate-enable-recompile-h)
#+end_src

*** Timestamps
#+begin_src emacs-lisp
(after! org
  (setq time-stamp-active t
        time-stamp-start "#\\+MODIFIED:[ \t]*"
        time-stamp-end "$"
        time-stamp-format "\[%Y-%m-%d %A %H:%M:%S\]"))
(add-hook 'before-save-hook 'time-stamp)
#+end_src

*** org-directory
I store my .org files in =~/.org= directory.
#+begin_src emacs-lisp
(setq org-directory "~/.org/")
#+end_src

*** org-crypt
To use this thing as I want, I need to configure epa package.
#+begin_src emacs-lisp
(after! epa
  (setq epg-pinentry-mode 'ask
        epa-file-encrypt-to "0xAD29C911170324A2"))
#+end_src

*** org-agenda
Looking for agenda in org-roam daily notes.
#+begin_src emacs-lisp
(setq org-agenda-files (list (expand-file-name "~/.org/roam/daily")))
#+end_src

Correcting org-agenda file names (files from org-journal break colors)
#+begin_src emacs-lisp
(setq org-agenda-prefix-format '((agenda . " %i %-16:c%?-12t% s")
                                 (todo   . " %i %-16:c")
                                 (tags   . " %i %-16:c")
                                 (search . " %i %-16:c")))
#+end_src

Saving DONE time in TODOs.
#+begin_src emacs-lisp
(setq org-log-done 'time)
#+end_src

*** org-roam
Setting =org-roam= directory.
#+begin_src emacs-lisp
(setq org-roam-directory (expand-file-name "~/.org/roam"))
#+end_src

Adding useful templates for org-roam notes.
#+begin_src emacs-lisp
(setq org-roam-capture-templates '(("d" "default" plain "%?"
                                    :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
                                                       "#+TITLE: ${title}\n")
                                    :unnarrowed t)))
#+end_src

Adding useful templates for org-roam to replace org-journal.
#+begin_src emacs-lisp
(defun +org/diary-catalog-entry ()
  "Generate entry for catalog."
  (let* ((org-roam-plist (plist-get org-capture-plist :org-roam))
         (time (plist-get org-roam-plist :override-default-time))
         (title (format-time-string "%A, %Y-%m-%d" time))
         (node (org-roam-node-from-title-or-alias title)))
    (if node
        (format "[[id:%s][%s]]" (org-roam-node-id node) title)
      (error "Diary entry '%s' doesn't exist." title))))

(setq org-roam-dailies-capture-templates
      (let ((catalog-file "catalog-%<%Y-%m>.org")
            (catalog-head (concat "#+TITLE: %<%B, %Y>\n"
                                  "#+CREATED: %U\n"
                                  "#+MODIFIED: %U\n"
                                  "* Entries\n"))
            (journal-file "%<%Y-%m-%d>.org")
            (journal-head (concat "#+TITLE: %<%A, %Y-%m-%d>\n"
                                  "#+CREATED: %U\n"
                                  "#+MODIFIED: %U\n"
                                  "* [/] Do Today\n"
                                  "* [/] Maybe Do Today\n"
                                  "* Journal\n")))
        `(("c" "catalog" item (function +org/diary-catalog-entry)
           :if-new (file+head+olp ,catalog-file ,catalog-head ("Entries"))
           :immediate-finish t)
          ("j" "journal" entry "* %<%r %Z>\n%?"
           :if-new (file+head+olp ,journal-file ,journal-head ("Journal")))
          ("t" "do today" entry "* TODO %?"
           :if-new (file+head+olp ,journal-file ,journal-head ("Do Today")))
          ("T" "do today (link)" entry "* TODO %a"
           :if-new (file+head+olp ,journal-file ,journal-head ("Do Today"))
           :immediate-finish t)
          ("m" "maybe do today" entry "* TODO %?"
           :if-new (file+head+olp ,journal-file ,journal-head ("Maybe Do Today")))
          ("M" "maybe do today (link)" entry "* TODO %a"
           :if-new (file+head+olp ,journal-file ,journal-head ("Maybe Do Today"))
           :immediate-finish t))))
#+end_src

Adding =org-roam-ui= package for web server.
#+begin_src emacs-lisp :tangle "packages.el"
(package! org-roam-ui)
#+end_src

Using =org-roam-ui=.
#+begin_src emacs-lisp
(use-package! websocket
  :after org-roam)

(use-package! org-roam-ui
  :after org-roam
  :config
  (setq org-roam-ui-sync-theme t
        org-roam-ui-follow t
        org-roam-ui-update-on-save t
        org-roam-ui-open-on-start t))
#+end_src

*** org-fc
This should help me with learning information from my knowledge storage, I hope.

*** org-pretty-table
Adding =org-pretty-table= package.
#+begin_src emacs-lisp :tangle packages.el
(package! org-pretty-table
  :recipe (:host github :repo "Fuco1/org-pretty-table") :pin "7bd68b420d3402826fea16ee5099d04aa9879b78")
#+end_src

Using =org-pretty-table= package.
#+begin_src emacs-lisp
(use-package! org-pretty-table
  :hook (org-mode . org-pretty-table-mode)
  :commands (org-pretty-table-mode global-org-pretty-table-mode))
#+end_src

*** Flasher
This is my flashcard system :3

Setting =flasher= preferences.
#+begin_src emacs-lisp
(setq flasher-directories '("~/.org/roam")
      flasher-review-learn-count nil
      flasher-review-review-count nil)
#+end_src

Adding =flasher= package.
#+begin_src emacs-lisp :tangle "packages.el"
(package! flasher
  :recipe (:host github :repo "mora-unie-youer/flasher")
  :pin "bc53ba6f07f80e58aa4979481797d5e52c091af0")
#+end_src

Using =flasher=.
#+begin_src emacs-lisp
(use-package! flasher
  :config
  (after! evil
    (evil-define-key* '(normal insert emacs) flasher-dashboard-mode-map
      "r" #'flasher-review
      "q" #'kill-current-buffer)
    (evil-define-minor-mode-key '(normal insert emacs) 'flasher-dashboard-deck-mode
      (kbd "q") 'flasher-dashboard-decks)
    (evil-define-minor-mode-key '(normal insert emacs) 'flasher-review-flip-mode
      (kbd "RET") 'flasher-review-flip
      (kbd "e")   'flasher-review-edit
      (kbd "s")   'flasher-review-next-card
      (kbd "q")   'flasher-review-quit
      (kbd "w")   'flasher-review-hint)
    (evil-define-minor-mode-key '(normal insert emacs) 'flasher-review-rate-mode
      (kbd "0") 'flasher-review-rate-0
      (kbd "1") 'flasher-review-rate-1
      (kbd "2") 'flasher-review-rate-2
      (kbd "3") 'flasher-review-rate-3
      (kbd "4") 'flasher-review-rate-4
      (kbd "5") 'flasher-review-rate-5
      (kbd "e") 'flasher-review-edit
      (kbd "s") 'flasher-review-next-card
      (kbd "q") 'flasher-review-quit)))
#+end_src

** which-key
Making popup a bit faster
#+begin_src emacs-lisp
(setq which-key-idle-delay 0.5)
#+end_src

Replacing =evil-= in function names
#+begin_src emacs-lisp
(setq which-key-allow-multiple-replacements t)
(after! which-key
  (pushnew!
   which-key-replacement-alist
   '(("" . "\\`+?evil[-:]?\\(?:a-\\)?\\(.*\\)") . (nil . "◂\\1"))
   '(("\\`g s" . "\\`evilem--?motion-\\(.*\\)") . (nil . "◃\\1"))
   ))
#+end_src

** Evil
Some =evil-mode= tweaks.
#+begin_src emacs-lisp
(after! evil
  (setq evil-ex-substitute-global t     ; I like my s/../.. to be global by default
        evil-move-cursor-back nil       ; Don't move the block cursor when toggling insert mode
        evil-kill-on-visual-paste nil)) ; Don't put overwritten text in the kill ring
#+end_src

** Company
Some useful tweaks for =company-mode=.
#+begin_src emacs-lisp
(after! company
  (setq company-idle-delay 0.5
        company-minimum-prefix-length 2)
  (setq company-show-numbers t)
  (add-hook 'evil-normal-state-entry-hook #'company-abort)) ;; make aborting less annoying.
#+end_src

** Keycast
Adding =keycast= package.
#+begin_src emacs-lisp :tangle "packages.el"
(package! keycast :pin "72d9add8ba16e0cae8cfcff7fc050fa75e493b4e")
#+end_src

Using =keycast-mode=.
#+begin_src emacs-lisp
(use-package! keycast
  :commands keycast-mode
  :config
  (define-minor-mode keycast-mode
    "Show current command and its key binding in the mode line."
    :global t
    (if keycast-mode
        (progn
          (add-hook 'pre-command-hook 'keycast--update t)
          (add-to-list 'global-mode-string '("" mode-line-keycast " ")))
      (remove-hook 'pre-command-hook 'keycast--update)
      (setq global-mode-string (remove '("" mode-line-keycast " ") global-mode-string))))
  (custom-set-faces!
    '(keycast-command :inherit doom-modeline-debug
                      :height 0.9)
    '(keycast-key :inherit custom-modified
                  :height 1.1
                  :weight bold)))
#+end_src

** Calculator
Default values for calculator.
#+begin_src emacs-lisp
(setq calc-angle-mode 'rad  ; radians are rad
      calc-symbolic-mode t) ; keeps expressions like \sqrt{2} irrational for as long as possible
#+end_src

Keybinding for calculator to open.
#+begin_src emacs-lisp
(after! evil
  (map! :leader
        :prefix "o"
        :desc "Calculator" "c" #'calc))
#+end_src

Embedded calculation.
#+begin_src emacs-lisp
(map! :map calc-mode-map
      :after calc
      :localleader
      :desc "Embedded calc (toggle)" "e" #'calc-embedded)
(map! :map org-mode-map
      :after org
      :localleader
      :desc "Embedded calc (toggle)" "E" #'calc-embedded)
(map! :map latex-mode-map
      :after latex
      :localleader
      :desc "Embedded calc (toggle)" "e" #'calc-embedded)
#+end_src

** Programming
*** Aggressive indentation
Adding =aggressive-indent= package.
#+begin_src emacs-lisp :tangle "packages.el"
(package! aggressive-indent)
#+end_src

Enabling =aggressive-indent-mode= only in =emacs-lisp-mode= for now.
#+begin_src emacs-lisp
(use-package! aggressive-indent
  :hook (emacs-lisp-mode . aggressive-indent-mode))
#+end_src

Adding keybinding to toggle =aggressive-indent-mode=.
#+begin_src emacs-lisp
(after! evil
  (map! :leader
        :prefix "t"
        :desc "Aggressive indent mode" "a" #'aggressive-indent-mode))
#+end_src

*** Emacs Lisp
Useful keybindings for package development.
#+begin_src emacs-lisp
(after! elisp-mode
  (map! :localleader
        :map emacs-lisp-mode-map
        "c" #'emacs-lisp-byte-compile-and-load))
#+end_src

*** Reset
This is my programming language :3

Adding =reset-mode= package.
#+begin_src emacs-lisp :tangle "packages.el"
(package! reset-mode
  :recipe (:host github :repo "mora-unie-youer/reset-mode")
  :pin "7f951130a63dd2ce5f3d64a6e176e0f155533412")
#+end_src

Using =reset-mode=.
#+begin_src emacs-lisp
(use-package! reset-mode)
#+end_src

Configuring indentation
#+begin_src emacs-lisp
(setq reset-indent-level 2)
#+end_src

Adding ligatures to Reset.
#+begin_src emacs-lisp
(after! reset-mode
  (set-ligatures! 'reset-mode
    :null "NULL"
    :false "FALSE" :true "TRUE"
    :return "return"))
#+end_src

Adding new rule for highlight-numbers-mode
#+begin_src emacs-lisp
(after! highlight-numbers
  (puthash 'reset-mode
           "\\_<\\(?:[[:digit:]]+\\|0[Xx][[:xdigit:]]+\\)\\_>"
           highlight-numbers-modelist))
#+end_src
